/**
 * 
 */
package cz.cvut.fit.bugtrac.dao;

import java.util.List;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import cz.cvut.fit.bugtrac.persistence.Author;

/**
 * data access object for author entity
 * 
 * @author Jarec
 * 
 */
@Component
@Transactional
public class AuthorDAOImpl extends AbstractBugTracDAO<Author> implements
		AuthorDAO {

	private static final String SELECT_FOR_AUTHORS = "SELECT a FROM Author a";

	@Override
	public Class<Author> getEntityClass() {
		return Author.class;
	}

	/**
	 * authors from datatstore
	 */
	@Override
	@Transactional(readOnly = true)
	public List<Author> getAuthors() {
		List<Author> resultList = em.createQuery(SELECT_FOR_AUTHORS)
				.getResultList();
		return resultList;
	}

}
